import log4js, {Log4js} from 'log4js'

const log_path = '../logs'
const config = {
    appenders: {
        // 控制台输出
        debug: {
            type: 'console'
        },
        // 文件输出
        info: {
            type: 'dateFile',
            filename: log_path + '/info',
            pattern: '-yyyy-MM-dd.log',
        },
        //错误日志 type:过滤类型logLevelFilter,将过滤error日志写进指定文件
        errorLog: {type: 'dateFile', filename: log_path + '/error', pattern: '-yyyy-MM-dd.log'},
        error: {type: "logLevelFilter", level: "error", appender: 'errorLog'}
    },
    categories: {
        default: {appenders: ['debug', 'info', 'error'], level: 'debug'},
        info: {appenders: ['info', 'error'], level: 'info'}
    }
}
log4js.configure(config)
export default log4js
